package org.hljdrl.daf.ft;

import java.util.ArrayList;
import java.util.List;

import org.hljdrl.daf.test.ModuleTest;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.app.FragmentStatePagerAdapter;


public class MyPagerAdapter  extends FragmentStatePagerAdapter{
	
	List<Fragment1> fragments = new ArrayList<Fragment1>();
	public MyPagerAdapter(FragmentManager fm,List<ModuleTest> modules) {
		super(fm);
		init(modules);
	}

	private void init(List<ModuleTest> modules)
	{
		for(ModuleTest item:modules){
			Fragment1 ft1 = new Fragment1();
			ft1.setModuleTest(item);
			fragments.add(ft1);
		}
	}
	
	@Override
	public CharSequence getPageTitle(int position) {
		return fragments.get(position).getModuleTest().getName();
	}

	@Override
	public int getItemPosition(Object object) {
		return POSITION_NONE;
	}
	@Override
	public int getCount() {
		return fragments.size();
	}

	@Override
	public Fragment getItem(int position) {
		return fragments.get(position);
	}

}
